<template>
<div class="login-box">
     <el-card>
          <el-form label-width="60px">
              <el-form-item label="用户名">
                    <el-input v-model="user.username"></el-input>
              </el-form-item>

            <el-form-item label="密码">
              <el-input v-model="user.password"></el-input>
            </el-form-item>

            <el-form-item >
              <el-button @click="btnLoginClick">登录</el-button>
            </el-form-item>
          </el-form>

     </el-card>
</div>
</template>

<script>
export default {
  name: "Login",
  data(){
     return {
         user:{
            username:'',
            password:''
         }
     }
  },methods:{
       btnLoginClick(){

          this.axios({
             url:'http://localhost:8080/user/login',
             method:'post',
              dataType:'json',
              params:this.user
          }).then((res)=>{
             if(res.data.success){
                alert('登录成功！')
             }else{
               alert('登录失败！')
             }
          })
       }
  }
}
</script>

<style scoped>


.login-box{
     width: 450px;
    margin-top: 400px;
    margin-left: 500px;
}
</style>